//
//  BJYCacheVideoCell.m
//  JW_BasePorject
//
//  Created by JW on 2018/7/2.
//  Copyright © 2018年 JW. All rights reserved.
//

#import "BJYCacheVideoCell.h"
#import "PMDownloadModel+ZYVideo.h"
@interface BJYCacheVideoCell ()

@property (nonatomic, strong)UILabel *titleLabel;

@property (nonatomic, strong)UILabel *detailsLabel;


@end

@implementation BJYCacheVideoCell

- (void)setPM_model:(PMDownloadModel *)PM_model{
    _PM_model = PM_model;
    self.titleLabel.text = PM_model.section_name;
    self.detailsLabel.text = [NSString stringWithFormat:@"时长%f分钟 | 大小%@",PM_model.duration/60,PM_model.zy_videoSize];
    
}

- (void)addChildViews{
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.detailsLabel];    
}

+ (BJYCacheVideoCell *)cellWithTableView:(UITableView *)tableView{
    static NSString *ident = @"BJYCacheVideoCell";
    BJYCacheVideoCell *cell = [tableView dequeueReusableCellWithIdentifier:ident];
    if (!cell) {
        cell = [[BJYCacheVideoCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ident];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
    
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addChildViews];
    }
    return  self;
}

- (UILabel *)titleLabel{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH - 20, 20)];
        _titleLabel.font = [UIFont systemFontOfSize:16];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

- (UILabel *)detailsLabel{
    if (_detailsLabel == nil) {
        _detailsLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, SCREEN_WIDTH - 20, 10)];
        _detailsLabel.font = [UIFont systemFontOfSize:13];
        _detailsLabel.textColor = [UIColor grayColor];
    }
    return _detailsLabel;
    
}

//- (void)awakeFromNib {
//    [super awakeFromNib];
//    // Initialization code
//}
//
//- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
//    [super setSelected:selected animated:animated];
//
//
//}

@end
